//
//  HeroDataViewController.m
//  LOL_JewelBox
//
//  Created by dllo on 15/4/30.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "HeroDataViewController.h"
#import "HeroView.h"
#import "UIImageView+WebCache.h"
@interface HeroDataViewController ()
@property(nonatomic, assign)NSInteger attack;
@property(nonatomic, assign)NSInteger defence;
@property(nonatomic, assign)NSInteger magic;
@property(nonatomic, assign)NSInteger difficulty;

@property(nonatomic, retain)UILabel *attackLabel;
@property(nonatomic, retain)UILabel *defenceLabel;
@property(nonatomic, retain)UILabel *magicLabel;
@property(nonatomic, retain)UILabel *difficultyLabel;
@property(nonatomic, retain)NSTimer *dispatchTime;

@property(nonatomic, retain)UILabel *level;
@property(nonatomic, retain)UILabel *baseAttack;
@property(nonatomic, retain)UILabel *baseDefence;
@property(nonatomic, retain)UILabel *baseMP;
@property(nonatomic, retain)UILabel *baseHP;
@property(nonatomic, retain)UILabel *baseDeadPercent;
@property(nonatomic, retain)UILabel *MPRecover;
@property(nonatomic, retain)UILabel *HPRecover;
@property(nonatomic, retain)UILabel *magicResist;

@end

@implementation HeroDataViewController
- (void)dealloc
{
    [_attackLabel release];
    [_defenceLabel release];
    [_magicLabel release];
    [_difficultyLabel release];
    [_dispatchTime release];
    [_level release];
    [_baseAttack release];
    [_baseDefence release];
    [_baseMP release];
    [_baseHP release];
    [_baseDeadPercent release];
    [_MPRecover release];
    [_HPRecover release];
    [_magicResist release];
    [super dealloc];
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{  self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {

    }
    return self;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self createView];





}
 - (void)createView
{    self.title = self.heroDataDic[@"displayName"];
    HeroView *heroView = [[HeroView alloc] initWithFrame:CGRectMake(0, 0, VIEWWIDTH, VIEWHEIGHT)];
    heroView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:heroView];
    [heroView release];
    UIScrollView *heroDataScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, VIEWWIDTH, VIEWHEIGHT)];
    [heroView addSubview:heroDataScrollView];
    [heroDataScrollView release];
    heroDataScrollView.contentSize = CGSizeMake(VIEWWIDTH, VIEWHEIGHT * 1.2);
    heroDataScrollView.backgroundColor = [UIColor blackColor];
    //英雄头像
    UIImageView *heroIron = [[UIImageView alloc] initWithFrame:CGRectMake(144 * VIEWWIDTH / 375.0, 10 * VIEWHEIGHT / 667, 100 * VIEWWIDTH / 375.0, 100 * VIEWWIDTH / 375.0)];
    [heroDataScrollView addSubview:heroIron];
    [heroIron release];
    NSString *heroName = [NSString stringWithFormat:@"http://img.lolbox.duowan.com/champions/%@_120x120.jpg",self.heroDataDic[@"name"]];

    [heroIron sd_setImageWithURL:[NSURL URLWithString:heroName] placeholderImage:[UIImage imageNamed:@"占位图"]];
//    heroIron.backgroundColor = [UIColor redColor];
    // 物理
    UILabel *attackNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20 * VIEWWIDTH / 375.0, 110 * VIEWHEIGHT / 667.0, 50 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    attackNameLabel.text = @"物理";
    attackNameLabel.textAlignment = NSTextAlignmentJustified;
    attackNameLabel.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:attackNameLabel];
    self.attackLabel = [[UILabel alloc] initWithFrame:CGRectMake(70 * VIEWWIDTH / 375.0, 110 * VIEWHEIGHT / 667.0, self.attack * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.attackLabel.layer.borderWidth = 0.5;
    self.attackLabel.layer.borderColor = [[UIColor whiteColor] CGColor];
    self.attackLabel.backgroundColor = [UIColor colorWithRed:57/255.0 green:5/255.0 blue:14/255.0 alpha:1];
    [heroDataScrollView addSubview:self.attackLabel];
    [_attackLabel release];

    // 防御
    UILabel *defenceNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20 * VIEWWIDTH / 375.0, 140 * VIEWHEIGHT / 667.0, 50 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    defenceNameLabel.text = @"防御";
    defenceNameLabel.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:defenceNameLabel];
    self.defenceLabel = [[UILabel alloc] initWithFrame:CGRectMake(70 * VIEWWIDTH / 375.0, 140 * VIEWHEIGHT / 667.0, self.defence * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.defenceLabel.layer.borderWidth = 0.5;
    self.defenceLabel.layer.borderColor = [[UIColor whiteColor] CGColor];
    self.defenceLabel.backgroundColor = [UIColor colorWithRed:11/255.0 green:32/255.0 blue:2/255.0 alpha:1];
    [heroDataScrollView addSubview:self.defenceLabel];
    [_defenceLabel release];
   // 法术
    UILabel *magicNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20 * VIEWWIDTH / 375.0, 170 * VIEWHEIGHT / 667.0, 50 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    magicNameLabel.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:magicNameLabel];
    magicNameLabel.text = @"法术";
    self.magicLabel = [[UILabel alloc] initWithFrame:CGRectMake(70 * VIEWWIDTH / 375.0, 170 * VIEWHEIGHT / 667.0, self.magic * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.magicLabel.layer.borderWidth = 0.5;
    self.magicLabel.layer.borderColor = [[UIColor whiteColor] CGColor];
    self.magicLabel.backgroundColor = [UIColor colorWithRed:12/255.0 green:25/255.0 blue:49/255.0 alpha:1];
    [heroDataScrollView addSubview:self.magicLabel];
    [_magicLabel release];
    //难度
    UILabel *difficultyNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20 * VIEWWIDTH / 375.0, 200 * VIEWHEIGHT / 667.0, 50 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    difficultyNameLabel.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:difficultyNameLabel];
    difficultyNameLabel.text = @"难度";
    self.difficultyLabel = [[UILabel alloc] initWithFrame:CGRectMake(70 * VIEWWIDTH / 375.0, 200 * VIEWHEIGHT / 667.0, self.difficulty * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.difficultyLabel.layer.borderWidth = 0.5;
    self.difficultyLabel.layer.borderColor = [[UIColor whiteColor] CGColor];
    self.difficultyLabel.backgroundColor = [UIColor colorWithRed:39/255.0 green:0 blue:53/255.0 alpha:1];
    [heroDataScrollView addSubview:self.difficultyLabel];
    [_difficultyLabel release];

    self.dispatchTime = [NSTimer scheduledTimerWithTimeInterval:0.015 target:self selector:@selector(dispatchAction:) userInfo:nil repeats:YES];

    // 英雄数据信息

    UISlider *heroLevel = [[UISlider alloc] initWithFrame:CGRectMake(50 * VIEWWIDTH / 375.0, 240 * VIEWHEIGHT / 667.0, 240 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    [heroDataScrollView addSubview:heroLevel];
    [heroLevel release];
    heroLevel.minimumValue = 1;
    heroLevel.maximumValue = 18;
//    heroLevel.value = 1;
    heroLevel.continuous = NO;
    [heroLevel addTarget:self action:@selector(changeValueAction:) forControlEvents:UIControlEventValueChanged];

    // 英雄数据Label
        // 等级
    UILabel *levelLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 270 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    levelLabel.textColor = [UIColor magentaColor];
    levelLabel.textAlignment = NSTextAlignmentRight;
    levelLabel.text = @"等级:";
    [heroDataScrollView addSubview:levelLabel];
    [levelLabel release];

    self.level = [[UILabel alloc] initWithFrame:CGRectMake(110 * VIEWWIDTH / 375.0, 270 * VIEWHEIGHT / 667.0, 60 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.level.text = @"1";
    self.level.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:self.level];
    [_level release];
    // 攻击范围
    UILabel *range = [[UILabel alloc] initWithFrame:CGRectMake(0, 300 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    range.text = @"攻击距离:";
    range.textAlignment = NSTextAlignmentRight;
    range.textColor = [UIColor orangeColor];
    [heroDataScrollView addSubview:range];
    [range release];
    UILabel *attackRange = [[UILabel alloc] initWithFrame:CGRectMake(110 * VIEWWIDTH / 375.0, 300 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    attackRange.text = self.heroDataDic[@"range"];
    attackRange.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:attackRange];
    [attackRange release];

    // 移动速度
    UILabel *move = [[UILabel alloc] initWithFrame:CGRectMake(0, 330 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    move.text = @"移动速度:";
    move.textAlignment = NSTextAlignmentRight;
    move.textColor = [UIColor grayColor];
    [heroDataScrollView addSubview:move];
    [move release];
    UILabel *moveSpeed = [[UILabel alloc] initWithFrame:CGRectMake(110 * VIEWWIDTH / 375.0, 330 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    moveSpeed.text = self.heroDataDic[@"moveSpeed"];
    moveSpeed.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:moveSpeed];
    [moveSpeed release];


    // 基础攻击

    UILabel *atLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 360 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    atLabel.text = @"基础攻击:";
    atLabel.textAlignment = NSTextAlignmentRight;
    atLabel.textColor = [UIColor redColor];
    [heroDataScrollView addSubview:atLabel];
    [atLabel release];
    self.baseAttack = [[UILabel alloc] initWithFrame:CGRectMake(110 * VIEWWIDTH / 375.0, 360 * VIEWHEIGHT / 667.0, 240 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.baseAttack.text = [NSString stringWithFormat:@"%@  ( %@ / 每级 )",self.heroDataDic[@"attackBase"],self.heroDataDic[@"attackLevel"]];
    self.baseAttack.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:self.baseAttack];
    [_baseAttack release];

    // 基础防御

    UILabel *deLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 390 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    deLabel.text = @"基础防御:";
    deLabel.textAlignment = NSTextAlignmentRight;
    deLabel.textColor = [UIColor brownColor];
    [heroDataScrollView addSubview:deLabel];
    [deLabel release];
    self.baseDefence = [[UILabel alloc] initWithFrame:CGRectMake(110 * VIEWWIDTH / 375.0, 390 * VIEWHEIGHT / 667.0, 240 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.baseDefence.text = [NSString stringWithFormat:@"%@  ( %@ / 每级 )",self.heroDataDic[@"armorBase"],self.heroDataDic[@"armorLevel"]];
    self.baseDefence.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:self.baseDefence];
    [_baseDefence release];

    // 基础魔法

    UILabel *manaLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 420 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    manaLabel.text = @"基础魔法:";
    manaLabel.textAlignment = NSTextAlignmentRight;
    manaLabel.textColor = [UIColor cyanColor];
    [heroDataScrollView addSubview:manaLabel];
    [manaLabel release];
    self.baseMP = [[UILabel alloc] initWithFrame:CGRectMake(110 * VIEWWIDTH / 375.0, 420 * VIEWHEIGHT / 667.0, 240 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.baseMP.text = [NSString stringWithFormat:@"%@  ( %@ / 每级 )",self.heroDataDic[@"manaBase"],self.heroDataDic[@"manaLevel"]];
    self.baseMP.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:self.baseMP];
    [_baseMP release];

    // 基础生命

    UILabel *healthyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 450 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    healthyLabel.text = @"基础生命:";
    healthyLabel.textAlignment = NSTextAlignmentRight;
    healthyLabel.textColor = [UIColor greenColor];
    [heroDataScrollView addSubview:healthyLabel];
    [healthyLabel release];
    self.baseHP = [[UILabel alloc] initWithFrame:CGRectMake(110 * VIEWWIDTH / 375.0, 450 * VIEWHEIGHT / 667.0, 240 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.baseHP.text = [NSString stringWithFormat:@"%@  ( %@ / 每级 )",self.heroDataDic[@"healthBase"],self.heroDataDic[@"healthLevel"]];
    self.baseHP.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:self.baseHP];
    [_baseHP release];

    // 暴击概率

    UILabel *criticalLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 480 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    criticalLabel.text = @"暴击概率:";
    criticalLabel.textAlignment = NSTextAlignmentRight;
    criticalLabel.textColor = [UIColor redColor];
    [heroDataScrollView addSubview:criticalLabel];
    [criticalLabel release];
    self.baseDeadPercent = [[UILabel alloc] initWithFrame:CGRectMake(110 * VIEWWIDTH / 375.0, 480 * VIEWHEIGHT / 667.0, 240 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.baseDeadPercent.text = [NSString stringWithFormat:@"%@  ( %@ / 每级 )",self.heroDataDic[@"criticalChanceBase"],self.heroDataDic[@"criticalChanceLevel"]];
    self.baseDeadPercent.textAlignment = NSTextAlignmentLeft;
    self.baseDeadPercent.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:self.baseDeadPercent];
    [_baseDeadPercent release];

    // 魔法恢复

    UILabel *manaRogenLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 510 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    manaRogenLabel.text = @"魔法恢复:";
    manaRogenLabel.textAlignment = NSTextAlignmentRight;
    manaRogenLabel.textColor = [UIColor cyanColor];
    [heroDataScrollView addSubview:manaRogenLabel];
    [manaRogenLabel release];
    self.MPRecover = [[UILabel alloc] initWithFrame:CGRectMake(110 * VIEWWIDTH / 375.0, 510 * VIEWHEIGHT / 667.0, 240 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.MPRecover.text = [NSString stringWithFormat:@"%@  ( %@ / 每级 )",self.heroDataDic[@"manaRegenBase"],self.heroDataDic[@"manaRegenLevel"]];
    self.MPRecover.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:self.MPRecover];
    [_MPRecover release];

    // 生命恢复

    UILabel *healthyRogenLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 540 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    healthyRogenLabel.text = @"生命恢复:";
    healthyRogenLabel.textAlignment = NSTextAlignmentRight;
    healthyRogenLabel.textColor = [UIColor greenColor];
    [heroDataScrollView addSubview:healthyRogenLabel];
    [healthyRogenLabel release];
    self.HPRecover = [[UILabel alloc] initWithFrame:CGRectMake(110 * VIEWWIDTH / 375.0, 540 * VIEWHEIGHT / 667.0, 240 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.HPRecover.text = [NSString stringWithFormat:@"%@  ( %@ / 每级 )",self.heroDataDic[@"healthRegenBase"],self.heroDataDic[@"healthRegenLevel"]];
    self.HPRecover.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:self.HPRecover];
    [_HPRecover release];


    // 魔法抗性

    UILabel *magicResistLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 570 * VIEWHEIGHT / 667.0, 100 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    magicResistLabel.text = @"魔法抗性:";
    magicResistLabel.textAlignment = NSTextAlignmentRight;
    magicResistLabel.textColor = [UIColor cyanColor];
    [heroDataScrollView addSubview:magicResistLabel];
    [magicResistLabel release];
    self.magicResist = [[UILabel alloc] initWithFrame:CGRectMake(110 * VIEWWIDTH / 375.0, 570 * VIEWHEIGHT / 667.0, 240 * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 667.0)];
    self.magicResist.text = [NSString stringWithFormat:@"%@  ( %@ / 每级 )",self.heroDataDic[@"magicResistBase"],self.heroDataDic[@"magicResistLevel"]];
    self.magicResist.textColor = [UIColor whiteColor];
    [heroDataScrollView addSubview:self.magicResist];
    [_magicResist release];



}
// 英雄数据信息随等级改变
- (void)changeValueAction:(UISlider *)slider
{   slider.value = round(slider.value);
    self.level.text = [NSString stringWithFormat:@"%g",slider.value];
    // 基础攻击
    self.baseAttack.text = [self heroDataUpdate:slider baseValue:self.heroDataDic[@"attackBase"] levelValue:self.heroDataDic[@"attackLevel"]];
    // 基础防御
    self.baseDefence.text = [self heroDataUpdate:slider baseValue:self.heroDataDic[@"armorBase"] levelValue:self.heroDataDic[@"armorLevel"]];
    // 基础魔法
    self.baseMP.text = [self heroDataUpdate:slider baseValue:self.heroDataDic[@"manaBase"] levelValue:self.heroDataDic[@"manaLevel"]];
    // 基础生命
    self.baseHP.text = [self heroDataUpdate:slider baseValue:self.heroDataDic[@"healthBase"] levelValue:self.heroDataDic[@"healthLevel"]];

    // 暴击概率

    self.baseDeadPercent.text = [self heroDataUpdate:slider baseValue:self.heroDataDic[@"criticalChanceBase"] levelValue:self.heroDataDic[@"criticalChanceLevel"]];
    // 魔法恢复

    self.MPRecover.text = [self heroDataUpdate:slider baseValue:self.heroDataDic[@"manaRegenBase"] levelValue:self.heroDataDic[@"manaRegenLevel"]];
    // 生命恢复

    self.HPRecover.text = [self heroDataUpdate:slider baseValue:self.heroDataDic[@"healthRegenBase"] levelValue:self.heroDataDic[@"healthRegenLevel"]];
    // 魔法抗性

    self.magicResist.text = [self heroDataUpdate:slider baseValue:self.heroDataDic[@"magicResistBase"] levelValue:self.heroDataDic[@"magicResistLevel"]];



}

// 数据处理方法
- (NSString *)heroDataUpdate:(UISlider *)slider baseValue:(NSString *)baseValue levelValue:(NSString *)levelValue
{
    CGFloat temp = slider.value;
    CGFloat base = [baseValue floatValue];
    CGFloat level = [levelValue floatValue];
    temp = base + level * temp;
    NSString *text = [NSString stringWithFormat:@"%g  ( %g / 每级 )",temp,level];



    return text;

}

// 动画效果
- (void)dispatchAction:(id)sender
{
    NSInteger attackNum = [self.heroDataDic[@"ratingAttack"] integerValue];
    NSInteger defenceNum = [self.heroDataDic[@"ratingDefense"]integerValue];
    NSInteger magicNum = [self.heroDataDic[@"ratingMagic"]integerValue];
    NSInteger difficultyNum = [self.heroDataDic[@"ratingDifficulty"]integerValue];


    if (self.attack <= attackNum * 20) {
        self.attack += 1;
        self.attackLabel.frame = CGRectMake(70 * VIEWWIDTH / 375.0, 110 * VIEWHEIGHT / 554.0, self.attack * VIEWWIDTH / 375.0, 20* VIEWHEIGHT / 554.0);
    }
    if (self.defence <= defenceNum * 20) {
        self.defence += 1;
        self.defenceLabel.frame = CGRectMake(70 * VIEWWIDTH / 375.0, 140* VIEWHEIGHT / 554.0, self.defence * VIEWWIDTH / 375.0, 20* VIEWHEIGHT / 554.0);
    }
    if (self.magic <= magicNum * 20) {
        self.magic += 1;
        self.magicLabel.frame = CGRectMake(70 * VIEWWIDTH / 375.0, 170* VIEWHEIGHT / 554.0, self.magic * VIEWWIDTH / 375.0, 20* VIEWHEIGHT / 554.0);
    }

    if (self.difficulty <= difficultyNum * 20) {
        self.difficulty += 1;
        self.difficultyLabel.frame = CGRectMake(70 * VIEWWIDTH / 375.0, 200* VIEWHEIGHT / 554.0, self.difficulty * VIEWWIDTH / 375.0, 20 * VIEWHEIGHT / 554.0);
    }
    if (self.attack > attackNum * 20 && self.defence > defenceNum * 20 && self.magic > magicNum * 20 && self.difficulty > difficultyNum* 20) {
        [self.dispatchTime invalidate];
    }


}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
